Given a maze[][] of dimension N X M, such that maze[i][j] = -1 represents a blocked cell and maze[i][j] = 0 represents an unblocked cell. The task is to count the number of ways to reach bottom-right cell starting from top-left cell by moving right (i, j+1) and down (i+1, j) in the maze....
Given a range of values [L, R] and a value K, the task is to count the numbers in the given range which are divisible by at least K of the digits present in the decimal representation of that number....
Given a matrix arr[][] of dimensions 2 * N, the task is to maximize the sum possible by selecting at most one element from each column such that no two consecutive elements are chosen from the same row....
Given an array arr[] of n elements and a number K, find the number of ordered subsets of arr[] having XOR of elements as K This is a modified version of this problem. So it is recommended to try that problem before.Examples:...
Given the current position of a Knight as (i, j), find the count of different possible positions visited by a knight after N moves (in a 10 x 10 board)....
Given a string S of length N, consisting of lowercase English alphabets only, the task is to find the minimum possible length of run-length-encoding that can be generated by removing at most K characters from the string S....
Given an array arr[] of (N – 1) integers and each value arr[i](1-based indexing) is the score of the nodes having degree i. The task is to determine the maximum score of any tree of N nodes that can be constructed....
Given an integer N which denotes the size of a matrix, the task is to find the number of possible ways to reach the bottom-right corner from the top-left corner of the matrix without crossing the diagonal of the matrix. The possible movements from any cell (i, j) from the matrix are (i, j + 1) (Right) or (i + 1, j) (Down)....
Given two arrays A[] and B[], each of size N, and two integers X and Y denoting the maximum number of elements that can be picked from A[] and B[] respectively, the task is to find the maximum possible sum by selecting N elements in such a way that for any index i, either A[i] or B[i] can be chosen. Note: It is guaranteed that (X + Y) >= N.Examples:...
Given a linear board of length N numbered from 1 to N, the task is to find the expected number of moves required to reach the Nth cell of the board, if we start at cell numbered 1 and at each step we roll a cubical dice to decide the next move. Also, we cannot go outside the bounds of the board. Note that the expected number of moves can be fractional.Examples:...
Given an integer K and a square matrix mat[][] of size N * N with elements from the range[1, K], the task is to count ways to remove pairs of distinct matrix elements such that remaining elements can be arranged in pairs vertically or horizontally....
Given an array arr[] containing integers. The task is to find the number of decreasing subarrays with a difference of 1....